package ynu.czs.feign;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
import ynu.czs.pojo.DeliveryAddress;
import ynu.czs.pojo.Result;

/**
 * 配送地址服务 Feign 客户端
 */
@FeignClient(name = "delivery-address-service")
public interface DeliveryAddressFeignClient {

    /**
     * 获取用户的所有配送地址
     */
    @GetMapping("/addressList/{userId}")
    Result list(@PathVariable("userId") Long userId);

    /**
     * 添加新的配送地址
     */
    @PostMapping("/addressList")
    Result addAddress(@RequestBody DeliveryAddress deliveryAddress);

    /**
     * 删除配送地址
     */
    @DeleteMapping("/addressList/{daId}")
    Result deleteAddress(@PathVariable("daId") Integer daId);

    /**
     * 更新配送地址
     */
    @PutMapping("/addressList")
    Result updateAddress(@RequestBody DeliveryAddress deliveryAddress);

    /**
     * 根据ID获取单个配送地址
     */
    @GetMapping("/addressList/daId/{daId}")
    Result getByDaId(@PathVariable("daId") Integer daId);
}